package de.tabuma.wsdl2xform.xform.view;

import de.tabuma.wsdl2xform.xform.constants;
import java.io.*;
import java.util.*;
import java.util.logging.*;
import javax.servlet.*;
import javax.servlet.http.*;
import de.tabuma.lib.tabumaview;

/**
 *
 * @author $Author: alefen $
 * @version $Revision: 1.3.4.1 $
 * @since $Date: 2010/01/13 10:23:55 $
 */
public class projectOverview extends tabumaview {

    private static Logger log = Logger.getLogger(projectOverview.class.getName());

    public projectOverview(String servlet, Hashtable parameter) {
        super(servlet, parameter);
    }

    public void processRequest(ServletContext context, HttpServletRequest request, HttpServletResponse response, PrintWriter out)  {
        try {

            int mainnav = de.tabuma.wsdl2xform.controller.constants.NAVID_CREATEXFORM;
            String subnav = de.tabuma.wsdl2xform.controller.constants.XFORMNAV;
            int subnavId = de.tabuma.wsdl2xform.controller.constants.XFORMNAV_NULL;

            out.println("<div class=\"contentHeader\">"+java.util.ResourceBundle.getBundle(de.tabuma.wsdl2xform.constants.projectLanguageBundle).getString("createxform.header")+"</div>");
            out.println("<div class=\"contentContent\">");
            out.println(java.util.ResourceBundle.getBundle(de.tabuma.wsdl2xform.constants.projectLanguageBundle).getString("createxform.content"));
            out.println("</div>");

            out.println("<div class=\"contentContent\">");
            out.println("\t<table class=\"table\">");
            out.println("\t\t<tr>");
            out.println("\t\t\t<td class=\"tableheader\">"+constants.getValue("license")+"</td>");
            out.println("\t\t\t<td class=\"tableheader\">"+constants.getValue("count")+"</td>");
            out.println("\t\t\t<td class=\"tableheader\">"+constants.getValue("usedlicenses")+"</td>");
            out.println("\t\t\t<td class=\"tableheader\">"+constants.getValue("unusedlicenses")+"</td>");
            out.println("\t\t</tr>");
            out.println("\t\t<tr>");
            out.println("\t\t\t<td class=\"tablecontent\">"+constants.getValue("xformcreationlicense")+"</td>");
            out.println("\t\t\t<td class=\"tablecontent\">"+"</td>");
            out.println("\t\t\t<td class=\"tablecontent\">"+"</td>");
            out.println("\t\t\t<td class=\"tablecontent\">"+"</td>");
            out.println("\t\t</tr>");
            out.println("\t\t<tr>");
            out.println("\t\t\t<td class=\"tablecontent\">"+constants.getValue("soapcalllicense")+"</td>");
            out.println("\t\t\t<td class=\"tablecontent\">"+"</td>");
            out.println("\t\t\t<td class=\"tablecontent\">"+"</td>");
            out.println("\t\t\t<td class=\"tablecontent\">"+"</td>");
            out.println("\t\t</tr>");
            out.println("\t</table>");
            out.println("</div>");

            String url = de.tabuma.wsdl2xform.controller.constants.SERVLET_NAME;
            url += "?";
            url += de.tabuma.wsdl2xform.controller.constants.MAINNAV+"="+de.tabuma.wsdl2xform.controller.constants.NAVID_CREATEXFORM;
            url += "&amp;";
            url += de.tabuma.wsdl2xform.controller.constants.XFORMNAV+"="+de.tabuma.wsdl2xform.controller.constants.XFORMNAV_NULL;

            out.println("\t<div class=\"tab\">");
            out.println("\t\t<div class=\"tabelementbeginnclose\"></div>");
            if(request.getAttribute(de.tabuma.wsdl2xform.controller.constants.XFORM_PROJECT_DROPED_MODE)==null) {
                out.println("\t\t<div class=\"tabelementopen\">"+constants.getValue("currentproject")+"</div>");
            }
            else {
                out.println("\t\t<div class=\"tabelementclose\"><a href=\""+url+"\">"+constants.getValue("currentproject")+"</a></div>");
            }
            if(request.getAttribute(de.tabuma.wsdl2xform.controller.constants.XFORM_PROJECT_DROPED_MODE)==null) {
                out.println("\t\t<div class=\"tabelementclose\"><a href=\""+url+"&amp;"+de.tabuma.wsdl2xform.controller.constants.XFORM_PROJECT_DROPED_MODE+"=true\">"+constants.getValue("dropedproject")+"</a></div>");
            }
            else {
                out.println("\t\t<div class=\"tabelementopen\">"+constants.getValue("dropedproject")+"</div>");
            }
            out.println("\t\t<div class=\"tabelementclose\"></div>");
            out.println("\t\t<div class=\"tabelementclose\"></div>");
            out.println("\t\t<div class=\"tabelementclose\"></div>");
            out.println("\t</div>");

            projectTable projecttable = new projectTable(this.getServlet(), this.getParameter());
            projecttable.processRequest(context, request, response, out);
            
        } 
        catch(Exception e) {
            log.warning(e.getMessage());
        }
    }

}
